/*
 * @Description: 
 * @Author: Aroma
 * @Date: 2024-09-13 17:46:34
 * @LastEditors: Aroma
 * @LastEditTime: 2024-09-13 17:47:07
 * @别瞎看: 你个无脑牛马
 */
public class Test02{
    public static void main(String[] args) {
        // 测试单例模式与实例化次数记录
        SingletonWithCounter singleton1 = SingletonWithCounter.getInstance();
        SingletonWithCounter singleton2 = SingletonWithCounter.getInstance();
        
        // 验证singleton1和singleton2是否是同一个实例
        System.out.println(singleton1 == singleton2); // 输出 true
        
        // 获取并打印实例化次数（注意：这里应为1，因为单例模式确保了只有一个实例被创建）
        System.out.println("Instance count: " + SingletonWithCounter.getInstanceCount()); // 输出 1，但注意这个计数与单例模式的初衷不符
        
        // 尝试再次获取实例，实例化次数不会增加（因为不会再次创建实例）
        SingletonWithCounter singleton3 = SingletonWithCounter.getInstance();
        System.out.println("Instance count after another getInstance(): " + SingletonWithCounter.getInstanceCount()); // 仍然是 1
    }
}
